package demo7;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * Spring管理对象时：单例或者多例
 *
 * 单例模式：singleton
 */

public class Demo {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context
                = new AnnotationConfigApplicationContext("demo7");
        DBConnect dbConnect = context.getBean(DBConnect.class);
        System.out.println(dbConnect);
        DBConnect dbConnect2 = context.getBean(DBConnect.class);
        System.out.println(dbConnect2);

    }
}
